package com.miplus.ccrm.workflow.nodes;

public abstract class BaseFlowConverter implements IFlowConverter {

    public abstract String print(String param);

    @Override
    public String printValue(String param){
        // 判断是否为数字
        if(!param.matches("-?\\d+(\\.\\d+)?")) {
            param = "\"" + param + "\"";
        }
        return print(param);
    }


    @Override
    public String tryCatch(String[] tryBlock, String[] catchBlock, String exceptionVar){
        String tryStr = String.join("\n",tryBlock);
        String catchStr = String.join("\n",catchBlock);
        return tryCatch(tryStr,catchStr,exceptionVar);
    }

}
